import { Component } from '@tarojs/taro'
import { View} from '@tarojs/components'
import { AtList, AtListItem,AtProgress  } from 'taro-ui'
import { DItemError  } from '@/components/'

import http from '@/api'

 import './statistics.scss'

export default class Index extends Component {

  constructor(props) {
    super(props)
    this.state = {
      list: []
    }
  }
  componentWillMount() {
  }
  componentDidShow() {
  }
  render() {
	let {list,count, active, flag} = this.props
	list = list ||[]
	if(count>=0){
	  list = list.slice(0,count)
	}
	let attrProps = this.props.attrProp||{name:'name',value:'value'}

    return (
      <View className=' b_CardealerList'>
        <View className='b_CardealerList__box'>
          <View className='b_CardealerList__content'>

				  <AtList hasBorder={true} >
				   {list.map((item,i)=>(<AtListItem
				     title={item[attrProps.name]}
					 className={{ListItemNot:i>=3}}
				     note={<View className='at-row'>
					 {i>2&&<View className='tipIcon'>{i+1}</View>}
					 <AtProgress  className='at-col at-col-10' percent={(+item[attrProps.value])/(+list[0][attrProps.value])*100} color='#F6C401' isHidePercent={true}/><View className='at-col t-center'>{item[attrProps.value]}</View></View>}
				      thumb={i<3?require('../assets/mortage/'+(i+1)+'.png'):false}

					 />))}
				  </AtList>
				  {!list.length&&<DItemError />}
          </View>
        </View>
        </View>
    )
  }
}
